package com.practice.backend.Controller;

import com.practice.backend.Common.Result;
import com.practice.backend.Entity.Menu;
import com.practice.backend.Repository.MenuRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/menu")
@CrossOrigin
public class MenuController {

    @Autowired
    MenuRepository menuRepository;



    @RequestMapping("/findAll")
    public Result findAll(){
        List<Menu> menus = menuRepository.findAll();
        return Result.success(true,"查询成功",menus.size(),menus);
    }
}
